﻿/*****************************************************************//**
 * @file    FITKMeshFeatureVTK.h
 * @brief   存储模型所有特征数据。
 *  
 * @author  ChengHaotian (yeguangbaozi@foxmail.com)
 * @date    2024-03-25
 *********************************************************************/

#ifndef _FITKMESHFEATURE_H___
#define _FITKMESHFEATURE_H___

#include "FITKInterfaceMeshAPI.h"
#include "FITK_Kernel/FITKCore/FITKAbstractDataObject.h"

// 前置声明
class vtkDataSet;
class vtkPolyData;
class vtkDataArray;

class FITKPolyDataNormals;
class FITKSurfaceFilter; 
class FITKShellFeatureEdges;
class FITKHighOrderCellFilter;

// 过滤器传递原始id数据名称
#define POINTIDNAME "vtkOriginalPointIds"
#define CELLIDNAME "vtkOriginalCellIds"

namespace Interface
{
    /**
     * @brief   模型特征数据类vtk实现。
     * @author  ChengHaotian (yeguangbaozi@foxmail.com)
     * @date    2024-03-25
     */
    class FITKInterfaceMeshAPI FITKMeshFeatureVTK : public Core::FITKAbstractDataObject
    {
    public:
        /**
         * @brief   构造函数。
         * @param   dataSet: 模型数据
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-25
         */
        explicit FITKMeshFeatureVTK(vtkDataSet* dataSet);

        /**
         * @brief   析构函数。[虚函数]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-25
         */
        virtual ~FITKMeshFeatureVTK();

        /**
         * @brief   更新特征。[虚函数]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-25
         */
        virtual void update();

        /**
         * @brief   设置模型数据。[虚函数]
         * @param   dataSet: 模型数据
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-25
         */
        virtual void reset(vtkDataSet* dataSet);

        /**
         * @brief   获取表面提取过滤器
         * @return  表面提取过滤器
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-22
         */
        FITKSurfaceFilter* getSurfaceFilter();

        /**
         * @brief   获取提取特征边过滤器
         * @return  提取特征边过滤器
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-22
         */
        FITKShellFeatureEdges* getFeatureEdgeFilter();

        /**
         * @brief   获取高阶单元过滤器
         * @return  高阶单元过滤器
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-22
         */
        FITKHighOrderCellFilter* getHighOrderFilter();

        /**
         * @brief   获取法向提取过滤器
         * @return  法向提取过滤器
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-22
         */
        FITKPolyDataNormals* getNormalsFilter();

        /**
         * @brief   获取特征网格
         * @param   type: 特征类型  1-表面 2-法向 3-特征边
         * @return  网格数据
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-22
         */
        vtkPolyData* getFeatureMesh(int type);

        /**
         * @brief   获取单元法向数据
         * @return  单元法向
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-22
         */
        vtkDataArray* getCellNormals();

    private:
        /**
         * @brief   模型数据
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-25
         */
        vtkDataSet* _dataSet{};

        /**
         * @brief   提取表面数据过滤器
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-25
         */
        FITKSurfaceFilter* _surfaceFilter{};

        /**
         * @brief   法向提取过滤器
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-25
         */
        FITKPolyDataNormals* _normalFilter{};

        /**
         * @brief   特征边提取过滤器
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-25
         */
        FITKShellFeatureEdges* _featureEdgeFilter{};

        /**
         * @brief   高阶单元过滤器
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-03-25
         */
        FITKHighOrderCellFilter* _highOrderFilter{};

    };
}

#endif
